
from fastapi import FastAPI
from loguru import logger

from initializer import g


app = FastAPI()

g.setup()

if __name__ == "__main__":
    import uvicorn

    host = g.conf.get('server', {}).get('host', '127.0.0.1')
    port = g.conf.get('server', {}).get('port', 8000)
    logger.info("Start server...")
    logger.info(f"接口文档地址：http://{host}:{port}/docs")
    uvicorn.run(app, host=host, port=port)
    logger.info("Server started successfully.")
